package seatiger.tomcat.catalina.connector;

import javax.servlet.ServletOutputStream;
import java.io.IOException;

/**
 * 继承ServletOutputStream，用户给客户端写回数据
 */
public class CoyoteOutputStream extends ServletOutputStream {

    protected OutputBuffer ob;

    protected CoyoteOutputStream(OutputBuffer ob) {
        this.ob = ob;
    }

    @Override
    public void write(int b) throws IOException {

    }

    @Override
    public void write(byte[] b) throws IOException {
        this.write(b,0,b.length);
    }

    @Override
    public void write(byte[] b, int off, int len) throws IOException {
        ob.write(b,off,len);
    }

    /*@Override
    public void flush() throws IOException {
        ob.flush();
    }*/
}
